//
//  ImgeLableSwitch.m
//  sensen_ios
//
//  Created by mc on 16/4/9.
//  Copyright © 2016年 pro. All rights reserved.
//

#import "ImgeLableSwitch.h"

@interface ImgeLableSwitch (){
  
    UIImageView * _view;
   
}


@end


@implementation ImgeLableSwitch



- (id)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        
        self.backgroundColor = rgba(220, 221, 222, 1);
        
        UILabel * lable = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 0.5)];
        [self addSubview:lable];
        lable.backgroundColor = [UIColor grayColor];

        _view = [[UIImageView alloc] init];
        [self addSubview:_view];
        
        [_view mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY);
            make.left.equalTo(self).offset(8);
            make.size.mas_equalTo(CGSizeMake(26, 26));
        }];
        
        _stateLable = [[UILabel alloc] init];
        [self addSubview:_stateLable];
        _stateLable.textColor = [UIColor grayColor];
        [_stateLable mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY);
            make.left.equalTo(_view.mas_right).offset(10);
            make.size.mas_equalTo(CGSizeMake(120, 20));
        }];
        
        
        
        self.Switch = [[UISwitch alloc] init];
        [self addSubview:self.Switch];
        [self.Switch mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY);
            make.right.equalTo(self.mas_right).offset(-8);
            make.size.mas_equalTo(CGSizeMake(61, 31));
        }];
    }
    return self;
}

- (void)setImageString:(NSString *)imageString{
    _view.image = [UIImage imageNamed:imageString];
}
- (void)setTitle:(NSString *)title{
    _stateLable.text = title;
}



@end
